package com.example.home7;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

@Database(entities = {User.class}, version = 1)
public abstract class MyRoomDatabase extends RoomDatabase {
    private static MyRoomDatabase instance;
    public abstract RoomDao roomDao();
    static MyRoomDatabase getInstance(Context context){
        if(instance==null){
            instance = Room
                    .databaseBuilder(context.getApplicationContext(),MyRoomDatabase.class,"room")
                    .allowMainThreadQueries().build();
        }
        return instance;
    }
}
